
package com.lungle.warmdiary.app.view.testcampaign;

import com.lungle.warmdiary.R;
import com.lungle.warmdiary.app.model.response.CampaignList;
import com.lungle.warmdiary.app.view.testcampaign.fragment.rate.CampaignRate1;
import com.lungle.warmdiary.app.view.testcampaign.fragment.rate.CampaignRate2;
import com.lungle.warmdiary.app.view.testcampaign.fragment.rate.CampaignRate3;
import com.lungle.warmdiary.app.view.testcampaign.fragment.rate.CampaignRate4;
import com.lungle.warmdiary.app.view.testcampaign.fragment.rate.CampaignRate5;
import com.lungle.warmdiary.app.view.testcampaign.fragment.rate.CampaignRateAll;


public enum CampaignDetailListTab {
    //todo 颜色不对
    CAMPAIGNALL(0, CampaignList.CATALOG_CAMPAIGN, R.string.campaign_star_0, 0xFF000000, 0, CampaignRateAll.class),
    CAMPAIGN5(1, CampaignList.CATALOG_CAMPAIGN, R.string.campaign_star_5, 0xFFF94848, 5, CampaignRate5.class),
    CAMPAIGN4(2, CampaignList.CATALOG_CAMPAIGN, R.string.campaign_star_4, 0xFFF94848, 4, CampaignRate4.class),
    CAMPAIGN3(3, CampaignList.CATALOG_CAMPAIGN, R.string.campaign_star_3, 0xFFF94848, 3, CampaignRate3.class),
    CAMPAIGN2(4, CampaignList.CATALOG_CAMPAIGN, R.string.campaign_star_2, 0xFFF94848, 2, CampaignRate2.class),
    CAMPAIGN1(5, CampaignList.CATALOG_CAMPAIGN, R.string.campaign_star_1, 0xFFF94848, 1, CampaignRate1.class);


    private Class<?> clz;
    private int idx;
    private int title;
    private int catalog;
    public int color;
    public int rate;

    private CampaignDetailListTab(int idx, int catalog, int title, int color, int rate, Class<?> clz) {
        this.idx = idx;
        this.clz = clz;
        this.color = color;
        this.rate = rate;
        this.setCatalog(catalog);
        this.setTitle(title);
    }

    public static CampaignDetailListTab getTabByIdx(int idx) {
        for (CampaignDetailListTab t : values()) {
            if (t.getIdx() == idx)
                return t;
        }
        return CAMPAIGNALL;
    }

    public static CampaignDetailListTab getTabByRate(int rate) {
        for (CampaignDetailListTab t : values()) {
            if (t.rate == rate)
                return t;
        }
        return CAMPAIGNALL;
    }

    public static int getTitleByRate(int rate) {
        for (CampaignDetailListTab t : values()) {
            if (t.rate == rate)
                return t.getTitle();
        }
        return CAMPAIGN1.getTitle();
    }

    public Class<?> getClz() {
        return clz;
    }

    public void setClz(Class<?> clz) {
        this.clz = clz;
    }

    public int getIdx() {
        return idx;
    }

    public void setIdx(int idx) {
        this.idx = idx;
    }

    public int getTitle() {
        return title;
    }

    public void setTitle(int title) {
        this.title = title;
    }

    public int getCatalog() {
        return catalog;
    }

    public void setCatalog(int catalog) {
        this.catalog = catalog;
    }
}
